<?php $cat = $this->get('cat');?>
<div class="nc">
<h2 class="nh"><?php _e($cat['title'])?></h2>
<div style="text-align:right;padding:5px 0px">
	<?php if( $this->hasRole('manage_news')):?>
	<a class="x-button x-fresh" href="#News/Manage">Duyệt bài</a>
	<?php endif;?>
	<a class="x-button x-fresh" href="#News/Index/Add">Đăng mới</a>
</div>
<?php if( count($this->get('posts')) > 0 ):?>
	<?php foreach( $this->get('posts') as $k => $post ):?>
		<div class="entry entry<?php _e($k);?>"><?php if( $post['img'] ):?>
			<a href="#News/Index/View?ID=<?php _e($post['ID'])?>">
			<img src="<?php _baseUrl();?>/files/news/<?php _e($post['img']);?>" class="ni"/>
			</a>
			<?php endif;?>
			<p>
				<a class="nt" href="#News/Index/View?ID=<?php _e($post['ID'])?>"><?php _e($post['title'])?></a><br/>
				<span style="color:#bbb"><?php _e(date('H:i A',strtotime($post['date'])))?> | <?php _e(date('d/m/Y',strtotime($post['date'])))?></span>
				<br/>
			<?php _e($post['desc'])?></p>
			<div align="right" style="font-size:11px">
				Đăng bởi<?php _e(get_user_link($post['created_by_id'],$post['created_by_name'],$post['created_is_deleted']) )?> | Đọc: [<?php _e($post['total_view'])?>] | Thảo luận: [<?php _e($post['total_comment'])?>]
			</div>
			<div class="clear"></div>
		</div>	
	<?php endforeach;?>

	<div class="clear"></div>
	<?php if( $this->get('page') ):?>
	<div align="right" style="padding:5px;border-top:1px solid #ddd" ><?php $this->e('page');?></div>
	<?php endif;?>
<?php else:?>
	<i>Chưa có bài viết nào </i>
<?php endif;?>
</div>